package com.tj.collection.controller.user;

import com.fqgj.msg.utils.Paged;
import com.tj.collection.common.Result;
import com.tj.collection.controller.user.request.UserBehaviorRequest;
import com.tj.collection.controller.user.request.UserListRequest;
import com.tj.collection.controller.user.response.ChannelDictResp;
import com.tj.collection.controller.user.response.UserBehaviorResponse;
import com.tj.collection.controller.user.response.UserInfoResponse;
import com.tj.collection.controller.user.response.UserResponse;
import com.tj.collection.db.service.UserManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: UserController
 * @description: 用户管理
 * @author: yuwn
 * @create: 2023-11-21 15:07
 */
@RestController
@RequestMapping("/user")
@Api(value = "用户管理接口", tags = {"用户管理接口"})
public class UserController {

    @Autowired
    private UserManageService userManageService;

    @ApiOperation("用户管理列表")
    @RequestMapping(value = "/getUserList", method = {RequestMethod.POST})
    public Result<Paged<List<UserResponse>>> getUserList(@RequestBody UserListRequest requestDTO){

        return Result.ok(userManageService.getUserList(requestDTO));
    }


    @ApiOperation("用户行为轨迹列表")
    @RequestMapping(value = "/getUserBehaviorList", method = {RequestMethod.POST})
    public Result<Paged<List<UserBehaviorResponse>>> getUserBehaviorList(@RequestBody UserBehaviorRequest requestDTO){

        return Result.ok(userManageService.getUserBehaviorList(requestDTO));
    }

    @ApiOperation("用户详情")
    @RequestMapping(value = "/getUserDescription", method = {RequestMethod.POST})
    public Result<UserInfoResponse> getUserDescription(@RequestBody UserListRequest requestDTO){

        return Result.ok(userManageService.getUserDescriptionByCode(requestDTO));
    }

    @ApiOperation("获取现有渠道列表")
    @RequestMapping(value = "/getChannelList", method = {RequestMethod.POST})
    public Result<List<ChannelDictResp>> getChannelList(){

        return Result.ok(userManageService.getChannelList());
    }
}
